package com.itheima.web;

import com.itheima.domain.User;
import com.itheima.service.UserService;
import com.itheima.service.impl.UserServiceImpl;
import org.junit.Test;

import java.util.List;

public class MyTest {
    private UserService service = new UserServiceImpl();
    private User user;
    private List<User> list;
    private Integer result;
    /**
     * //查询全部
     */
    @Test
    public void findAll(){
        list = service.findAll();
        for (User user:list
             ) {
            System.out.println(user);
        }
    }

    /**
     * 查询一个
     */
    @Test
    public void findById(){
        user =service.findById(1);
        System.out.println(user);
    }

    /**
     * 增加
     */
    @Test
    public void insert(){
        user = new User(5,"mark","123","12311111111");
        result=service.insert(user);
        System.out.println(result);
    }

    /**
     * 修改
     */
    @Test
    public void update(){
        user= new  User(4,"anna","123","12311111111");
        result=service.update(user);
        System.out.println(result);
    }

    /**
     * 删除
     */
    @Test
    public void delete(){
        result= service.delete(5);
        System.out.println(result);
    }

}
